#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
int main(int argc ,char *argv[])
{
    int fd = open("/dev/myKey",O_RDWR);  
    int fd_led = open("/dev/gpioLED",O_RDWR); 
    if(fd<0||fd_led<0)
        printf("open error!\r\n");
    while(1)
    {
        static char switc;
        char flag = 0;
        int ret = 0;
        read(fd,&flag,1);
        if(flag==1)
          switc = !switc;
        write(fd_led,&switc,1);
    }
    close(fd);
    close(fd_led);
    return 0;
}